import { getStore } from './storage-utils'
export default {
  IS_LOGIN (state) {
    if (state.token == null || state.token.length <= 0) {
      console.log('use logal stoge token')
      return getStore('token') != null
    }
    return true
  },
  USER_INFO (state) {
    console.log(state)
    if (state.userInfo == null) {
      console.log('use local stoge userInfo')
      return getStore('userInfo')
    }
    return state.userInfo
    // return state.token && state.token.length > 0 && state.userInfo != null ? state.userInfo.headImg : 'https://leven-test-bucket.nos-eastchina1.126.net/reader/bird.png'
  },
  USER_NICK (state) {
    console.log('user nick load')
    return this.IS_LOGIN(state) && state.userInfo != null ? state.userInfo.nickname : ''
  }
}
